function [ new_eta ] = adaptative_eta( cost, previous_cost)

global ETA;
global a;
global b;
global K;
global k_eta_adap;
%ADAPTATIVE_ETA Summary of this function goes here
%   Detailed explanation goes here

if (cost - previous_cost) > 0
    new_eta = ETA - b * ETA;
    k_eta_adap = 0;
elseif (cost - previous_cost) < 0
    k_eta_adap = k_eta_adap + 1;
    if k_eta_adap == K
        new_eta = ETA + a;
        k_eta_adap = 0;
    else
        new_eta = ETA;
    end
else
    new_eta = ETA;
end

end

